package com.dhcc.core.modules.system.warpper;

import java.util.List;
import java.util.Map;

import com.dhcc.core.framework.base.warpper.BaseControllerWarpper;
import com.dhcc.core.framework.constant.state.ManagerStatus;
import com.dhcc.core.modules.system.cache.dept.DeptCache;
import com.dhcc.core.modules.system.cache.dict.DictCache;
import com.dhcc.core.modules.system.cache.position.PositionCache;
import com.dhcc.core.modules.system.cache.role.RoleCache;

/**
 * 用户管理的包装类
 * 
 * @ClassName: UserWarpper
 * @Description: TODO
 * @author: cyf
 * @date: 2018年1月2日 上午10:43:57
 */
public class UserWarpper extends BaseControllerWarpper {

    public UserWarpper(List<Map<String, Object>> list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
        map.put("sexName", DictCache.me().findDictNameByPcodeAndKey("sex", map.get("sex")+""));
        map.put("deptName", DeptCache.me().getDeptNameById((Long) map.get("deptId")));
        map.put("statusName", ManagerStatus.valueOf((Integer) map.get("status")));
        map.put("position",  PositionCache.me().getPositionNameById((Long)map.get("positionId")));
        map.put("roleName", RoleCache.me().getRoleNamesByIds((String)map.get("roleId")));
    }

}
